package com.antgroup.seckill.business.goods.controller;


import com.antgroup.seckill.business.common.rabbitmq.MQSender;
import com.antgroup.seckill.business.common.vo.response.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wangxy
 * @since 2024-07-25
 */
@RestController
@RequestMapping("/order")
public class UserController {

 /*   @Autowired
    private MQSender mqSender;

    @RequestMapping("/sendMq")
    @ResponseBody
    public void sendMessage() {
        mqSender.send("测试发送消息");
    }

    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void sendMessageTopic01() {
        mqSender.send01("测试发送消息topic01");
    }

    @RequestMapping("/mq/topic02")
    @ResponseBody
    public void sendMessageTopic02() {
        mqSender.send02("测试发送消息topic02");
    }*/

    @Autowired
    private KafkaTemplate<String,Object> kafkaTemplate;

    @GetMapping("/sendKafka/{num}")
    public RespBean sendKafka(@PathVariable("num") String num) {
        kafkaTemplate.send("seckill-orer","这是一个消息，num=" + num);
        return RespBean.success();
    }

}
